#!/bin/bash


export DASHSCOPE_API_KEY=sk-178f7fc245424c92b4b93ebc4eac1df8

if [ ! -e /opt/statics/models/models ]; then mkdir -p /opt/statics/models/models; fi
if [ ! -e /opt/statics/models/music ]; then mkdir -p /opt/statics/models/music; fi
if [ ! -e /opt/statics/models/lcr ]; then mkdir -p /opt/statics/models/lcr; fi

# 初始化
python3 manage.py inited

# 启动异步组件服务
# [DEBUG|INFO|WARNING|ERROR|CRITICAL|FATAL]
# python3 manage.py celery worker --loglevel=info --logfile=/opt/logs/celery_worker.log &
# nohup 
celery -A iClouds worker -l debug -f /opt/logs/celery_worker.log &
# sleep 10

# nohup 
# -S django
# --scheduler django_celery_beat.schedulers:DatabaseScheduler
# celery -A iClouds beat -l debug -f /opt/logs/celery_beat.log &
# sleep 10

# 用于开发环境的项目单线程启动
python3 manage.py runserver 0.0.0.0:8000